<!doctype html>
<html>
<head>
    <!--Setting-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable"  content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no">
    
    
    <!--Simple SEO-->


<meta name="robots" content=all />
<meta name="google" content=all />
<meta name="googlebot" content=all />
<meta name="verify" content=all />
    <!--Title-->

<title>CentOS7 Docker修改挂载卷为OverlayFS | MIAbon&#39;s blog</title>

<link rel="alternate" href="/atom.xml" title="MIAbon&#39;s blog" type="application/atom+xml">


<link rel="icon" href="/favicon.ico">

    
<link rel="stylesheet" href="/css/base.css">
<link rel="stylesheet" href="/css/pages/post.css">
<link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/thirdParty/highlight/github.css">
<link rel="stylesheet" href="/.css">

    <!--script-->


<script src="http://cdn1.lncld.net/static/js/3.2.1/av-min.js"></script>
<script>
  var appId = "i7AHmC7NPbPtgS3YxT67dRIc-9Nh9j0Va";
  var appKey = "g6TKbY8O4TsCDMcemoC3STvQ";
  var region = "";
  AV.init({
    appId: appId,
    appKey: appKey,
    region: region
  });
</script>


<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<!--<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>-->


    
    
</head>

<body id="normal">
<!--[if lte IE 8]>
<style>
    html{ font-size: 1em }
</style>
<![endif]-->
<!--[if lte IE 9]>
<style>
    header{ top: 71px; position: absolute!important;}
    #container{padding-top: 151px!important;}
</style>
<div style="position:fixed;z-index:9999;left:0;top:0;width:100%;height:70px;background-color:#e0e0e0;color:#396CA5;border-bottom:1px solid #cecece;text-align:center;line-height:70px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis">你使用的浏览器版本过低，为了你更好的阅读体验，请更新浏览器的版本或者使用其他现代浏览器，比如Chrome、Firefox、Safari等。</div>
<![endif]-->

<div id="wrap">
    <header  style="position: absolute;" >
    <div id="site-meta">
        <a href="/" id="logo">
            <h1 class="title">MIAbon&#39;s blog</h1>
        </a>
        
    </div>
    <ul id="nav">
        
            <li><a href="/"><i class="fa fa-home"></i>首页</a></li>
        
            <li><a href="/atom.xml"><i class="fa fa-rss"></i>RSS</a></li>
        
        <li id="search"><a href="javascript:void(0)"><i class="fa fa-search"></i>搜索</a></li>
    </ul>
</header>

    <div id="container">
        
<ul id="sidebar">
    
    
    
    
<li class="widget widget-normal category">
    <h3 class="fa fa-th widget-title">分类</h3>
    <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/ELK/"><i class="fa" aria-hidden="true">ELK</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Lvs/"><i class="fa" aria-hidden="true">Lvs</i></a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/admin/"><i class="fa" aria-hidden="true">admin</i></a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/ansible/"><i class="fa" aria-hidden="true">ansible</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/aws/"><i class="fa" aria-hidden="true">aws</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/docker/"><i class="fa" aria-hidden="true">docker</i></a><span class="category-list-count">7</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/drone/"><i class="fa" aria-hidden="true">drone</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/"><i class="fa" aria-hidden="true">kernel</i></a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/kubernetes/"><i class="fa" aria-hidden="true">kubernetes</i></a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/kvm/"><i class="fa" aria-hidden="true">kvm</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mongodb/"><i class="fa" aria-hidden="true">mongodb</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link current" href="/categories/python/"><i class="fa" aria-hidden="true">python</i></a><span class="category-list-count">9</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/share/"><i class="fa" aria-hidden="true">share</i></a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/web/"><i class="fa" aria-hidden="true">web</i></a><span class="category-list-count">12</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/zabbix/"><i class="fa" aria-hidden="true">zabbix</i></a><span class="category-list-count">3</span></li></ul>
</li>


    
    
<li class="widget widget-normal archive">
  <h3 class="fa fa-archive widget-title">归档</h3>
    <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/"><i class="fa" aria-hidden="true">二月 2018</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/"><i class="fa" aria-hidden="true">一月 2018</i></a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/12/"><i class="fa" aria-hidden="true">十二月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/11/"><i class="fa" aria-hidden="true">十一月 2017</i></a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/10/"><i class="fa" aria-hidden="true">十月 2017</i></a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/09/"><i class="fa" aria-hidden="true">九月 2017</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/"><i class="fa" aria-hidden="true">八月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/"><i class="fa" aria-hidden="true">五月 2017</i></a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/"><i class="fa" aria-hidden="true">四月 2017</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/"><i class="fa" aria-hidden="true">三月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/01/"><i class="fa" aria-hidden="true">一月 2017</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/12/"><i class="fa" aria-hidden="true">十二月 2016</i></a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/"><i class="fa" aria-hidden="true">十一月 2016</i></a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/10/"><i class="fa" aria-hidden="true">十月 2016</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/"><i class="fa" aria-hidden="true">八月 2016</i></a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/05/"><i class="fa" aria-hidden="true">五月 2016</i></a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/"><i class="fa" aria-hidden="true">四月 2016</i></a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/"><i class="fa" aria-hidden="true">五月 2015</i></a><span class="archive-list-count">1</span></li></ul>
</li>


    
    
<li class="widget widget-normal tags">
  <h3 class="fa fa-tags widget-title">标签云</h3>
  <div class="tagcloud-content">
    
      <a href="/tags/drone/" style="font-size: 0.14rem; color: #69c">drone</a> <a href="/tags/linux/" style="font-size: 0.2rem; color: #0a407c">linux</a> <a href="/tags/kernel/" style="font-size: 0.16rem; color: #4f83b8">kernel</a> <a href="/tags/ELK/" style="font-size: 0.14rem; color: #69c">ELK</a> <a href="/tags/ansible/" style="font-size: 0.14rem; color: #69c">ansible</a> <a href="/tags/swarm/" style="font-size: 0.14rem; color: #69c">swarm</a> <a href="/tags/docker/" style="font-size: 0.18rem; color: #215690">docker</a> <a href="/tags/firewalld/" style="font-size: 0.14rem; color: #69c">firewalld</a> <a href="/tags/zabbix/" style="font-size: 0.16rem; color: #4f83b8">zabbix</a> <a href="/tags/aws/" style="font-size: 0.14rem; color: #69c">aws</a> <a href="/tags/web/" style="font-size: 0.16rem; color: #4f83b8">web</a> <a href="/tags/python/" style="font-size: 0.18rem; color: #215690">python</a> <a href="/tags/spider/" style="font-size: 0.17rem; color: #386da4">spider</a>
  </div>
</li>


    
    
<li class="widget widget-normal friends-link">
    <h3 class="fa fa-globe widget-title">友链</h3><br/>

    
        <a href="http://zhengwei666.wang" class="fa" target="_blank">zhengwei</a>

    
        <a href="https://you-deng.github.io" class="fa" target="_blank">dengyou</a>

    
        <a href="http://www.systemd.cn" class="fa" target="_blank">langyaoliang</a>

    
        <a href="http://www.chen-hao.com.cn/" class="fa" target="_blank">chenhao</a>

    
        <a href="http://www.yulongjun.com" class="fa" target="_blank">yulongjun</a>

    

</li>

    
</ul>


        <div id="main">
    <article id="post">
        <div id="post-header">

            <h1 id="CentOS7 Docker修改挂载卷为OverlayFS">
                
                CentOS7 Docker修改挂载卷为OverlayFS
                
            </h1>
            <div class="article-meta">
    
    
    <span class="categories-meta fa-wrap">
            <i class="fa fa-folder-open-o"></i>
        <span>docker</span>
    </span>
    
    
    <span class="fa-wrap">
         <i class="fa fa-tags"></i>
        <span class="tags-meta">
            
            linux
            
        </span>
    </span>
    
    
    <span class="fa-wrap">
        <i class="fa fa-clock-o"></i>
        <span class="date-meta ">2016/11/29</span>
    </span>
    
    
    <span class="fa-wrap">
            <i class="fa fa-thermometer-three-quarters"></i>
        <span class="hits hits-meta " data-leadcloud-title="CentOS7 Docker修改挂载卷为OverlayFS"
              data-leadcloud-url="/2016/11/29/CentOS7_Docker修改挂载卷为OverlayFS/"><i class="fa fa-spinner fa-spin"></i></span>
    </span>
    
    
</div>

            
            
            <p class="fa fa-exclamation-triangle warning">
                本文于<strong>430</strong>天之前发表，文中内容可能已经过时。如有疑问，请在评论区留言。
            </p>
            
        </div>
        
        <div id="post-body">
            <h1 id="ovelayfs简介："><a href="#ovelayfs简介：" class="headerlink" title="ovelayfs简介："></a>ovelayfs简介：</h1><p>overlayfs本身是一个叠加文件系统，用于叠合多个文件系统形成一个新的文件系统，使用方式如下：<br>mount -t overlay overlay -olowerdir=/lower, upperdir=/upper, workdir=/work /merged<br>简单的说overlayfs通过Linux内核VFS层的灵活性能够将对文件A的修改变成对B的修改，利用这种灵活性来完成文件系统叠加的效果。比如指令：<br>/lower：是下层的文件系统，通常是只读的。可以放我们的镜像模板的rootfs 如果我们要对其中某个文件做修改，比如文件A，则overlayfs会将该文件拷贝到/upper目录中修改，也就是实现了文件级别的CoW。<br>/merged ：是最终叠加后形成的文件系统，也就是用户实际使用看到叠加效果后的文件系统。</p>
<h1 id="device-mapper简介："><a href="#device-mapper简介：" class="headerlink" title="device-mapper简介："></a>device-mapper简介：</h1><p>device-mapper(后面简称dm)本身是一个位于内核通用块层的一个框架，完成内核IO的一些策略定制等功能，比如可以通过dm完成磁盘的软raid功能，比如facebook前些时间开源的flashcache缓存方案也是基于device-mapper的。<br>DM是一个框架，提供了通用的一套框架完成IO的重定向及定制等策略，它包含很多具体的策略实现，Docker用到的是其中的thin-provision。thin-provision本质上提供两个功能：<br>磁盘空间按需分配，这个特点决定了如果Docker使用dm驱动，则对应的盘大小默认10G，实际是不占任何空间的，直到你真正写入数据，才会占用实际的磁盘空间。<br>基于block块粒度的CoW，如上面overlayfs原理类似，我要修改一个文件，thin-provision会将修改的部分对应的磁盘块单独拷贝出来一份修改，这里粒度是要小于overlayfs的。</p>
<p><strong>Docker服务启动时默认会在/var/lib/docker/devicemapper/devicemapper/目录创建一个100G（由于1000和1024换算的关系，系统实际显示的是107.4G，其他数字亦同）的data文件，然后启动的容器的所有变更的数据全部保存到这个data文件中；也就是说当容器内产生的相关data数据超过100G后容器就再也没有多余的空间可用，从而导致所有容器的根目录变为只读！同时它会限制每个容器最大为 10GB</strong></p>
<h2 id="解决方案"><a href="#解决方案" class="headerlink" title="解决方案"></a>解决方案</h2><p>使用更大的文件、磁盘、逻辑卷创建data文件</p>
<h3 id="使用文件"><a href="#使用文件" class="headerlink" title="使用文件"></a>使用文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">dd <span class="keyword">if</span>=dev/zero of=/var/lib/docker/devicemapper/devicemapper/data bs=1G count=0 seek=1000</div><div class="line"><span class="comment">#这样会创建一个虚拟的1000G大小的data文件，如果不加seek参数，count直接为1000的话，则是创建了一个结结实实的1000G的文件~</span></div></pre></td></tr></table></figure>
<h3 id="使用磁盘"><a href="#使用磁盘" class="headerlink" title="使用磁盘"></a>使用磁盘</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ln -s /dev/sdb /var/lib/docker/devicemapper/devicemapper/data</div></pre></td></tr></table></figure>
<h3 id="使用逻辑卷"><a href="#使用逻辑卷" class="headerlink" title="使用逻辑卷"></a>使用逻辑卷</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ln -s /dev/mapper/centos-dockerdata /var/lib/docker/devicemapper/devicemapper/data</div></pre></td></tr></table></figure>
<h1 id="dm与overlayfs之间的选择："><a href="#dm与overlayfs之间的选择：" class="headerlink" title="dm与overlayfs之间的选择："></a>dm与overlayfs之间的选择：</h1><p>从上面原理上分析不难得出一个结论，dm的CoW的粒度是要比overlayfs的小的，也就是说如果用overlayfs做驱动，存在的问题是如果模板rootfs中有个比较大的文件在大多数容器中都可能会动态修改，则这个文件需要整个copyup到上层文件系统，而用dm则只需要CoW修改的那个块。<br>从这方面讲dm是占优的，但是dm在使用中存在很多功能限制，因为它本身是一个块设备，所以并不了解上层文件系统的细节，使用中存在种种限制，并且在文件系统缓存这层也没有overlayfs有效。但是overlayfs需要3.18以上kernel才支持。大多数Linux发行版还不支持这么高的内核版本，所以需要单独编译。<br><strong>在内核3.18中，overlayfs终于正式进入主线。相比AUFS，overlayfs设计简单，代码也很少。而且可以实现pagecache共享。似乎是一个非常好的选择。于是，在这之后，docker社区开始转向将overlayfs作为第一选择。</strong></p>
<h1 id="启用overlay"><a href="#启用overlay" class="headerlink" title="启用overlay"></a>启用overlay</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">echo</span> <span class="string">"overlay"</span> &gt; /etc/modules-load.d/overlay.conf</div><div class="line">reboot <span class="comment">#重启</span></div></pre></td></tr></table></figure>
<h1 id="确认overlay启用"><a href="#确认overlay启用" class="headerlink" title="确认overlay启用"></a>确认overlay启用</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">lsmod | grep over</div><div class="line">overlay</div></pre></td></tr></table></figure>
<h1 id="配置docker使用overlay"><a href="#配置docker使用overlay" class="headerlink" title="配置docker使用overlay"></a>配置docker使用overlay</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">mkdir -p /etc/systemd/system/docker.service.d &amp;&amp; tee /etc/systemd/system/docker.service.d/override.conf &lt;&lt;- EOF</div><div class="line">[Service]</div><div class="line">ExecStart=</div><div class="line">ExecStart=/usr/bin/dockerd --graph=<span class="string">"/mnt/docker-data"</span> --storage-driver=overlay</div><div class="line">EOF</div></pre></td></tr></table></figure>
<h1 id="启动-amp-amp-查看"><a href="#启动-amp-amp-查看" class="headerlink" title="启动&amp;&amp;查看"></a>启动&amp;&amp;查看</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">systemctl daemon-reload &amp;&amp; systemctl start docker</div></pre></td></tr></table></figure>
<h2 id="修改前"><a href="#修改前" class="headerlink" title="修改前"></a>修改前</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">docker info | grep <span class="string">"Storage Driver"</span></div><div class="line">Storage Driver: devicemapper</div></pre></td></tr></table></figure>
<h2 id="修改后"><a href="#修改后" class="headerlink" title="修改后"></a>修改后</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">docker info | grep <span class="string">"Storage Driver"</span></div><div class="line">Storage Driver: overlay</div></pre></td></tr></table></figure>
        </div>
        <div id="post-footer">
            <div class="avatar" >
                <img src="/img/author.jpg" alt="avatar"/>
                <!-- 
                <a href="javascript:void(0)" class="high-song">high起来 &#128541;</a>
                 -->
                
                <a href="http://backup-miabon.oss-cn-hongkong.aliyuncs.com/img/alipay.jpg" target="_blank" class="donate fa">打赏小弟 &#128536;</a>
                
            </div>
            <ul class="author-profile-section">
                <li>
                  
                  作者:
                  
                    
                    <a href="/about.html">MIAbon</a>
                </li>
                
                <li>发表日期: <span>2016-11-29  00:00:00</span></li>
                
                <li>最后编辑日期: <span>2017-11-23  08:23:00</span></li>
                
                <li class="post-category">
                    文章分类:
                    
                    <a href="/categories/docker/">docker</a>
                    
                </li>
                <li class="post-tags">
                    文章标签:
                    
                    <a href="/tags/linux/">linux</a>
                    
                    <a href="/tags/docker/">docker</a>
                    
                </li>
                
                <li> 版权声明: <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/" target="_blank">
知识共享署名-非商业性使用-禁止演绎 3.0 未本地化版本许可协议（CC BY-NC-ND 3.0）
</a></li>
                
            </ul>
            <div id="donate-wrap">
                
                
                
                <img src="http://www.geasslinks.com/img/alipay.jpg" alt="支付宝付款" class="donate-img">
                
                
            </div>
        </div>
    </article>
    <div class="article-nav">
        
        <a href="/2016/11/29/oh_my_zsh/" class="pre-post fa fa-caret-left">oh my zsh</a>
        
        
        <a href="/2016/11/29/CentOS7升级内核/" class="next-post fa">CentOS7升级内核</a>
        
    </div>
    
    <div id="comments">
        

<script>
  gitment.render(document.getElementById("comments"));
</script>



    </div>
    
</div>


    </div>
    <footer id="footer">
    
    <div class="social">
        
        <a href="https://www.example1.com" class="fa fa-free-code-camp" target="_blank" title="freecodecamp"></a>
        
        <a href="https://github.com/werewolf2101" class="fa fa-github" target="_blank" title="Follow me~"></a>
        
        <a href="mailto:werewolf2101@gmail.com" class="fa fa-email" target="_blank" title="Email"></a>
        
    </div>
    
    <div>
        
        <a href="/" class="copyright-links">MIAbon</a>&copy;2015 - 2018.All Rights
        Reserved.
    </div>
    <p>Powered by <a href="https://hexo.io" class="copyright-links" target="_blank">Hexo</a> | Theme by <a
                href="https://github.com/GeekaholicLin" class="copyright-links" target="_blank">GeekaholicLin</a>
    </p>
    
    
    <p>
        <span id="busuanzi_container_site_uv" class="fa fa-bar-chart">
        欢迎第<span id="busuanzi_value_site_uv"><i class="fa fa-spinner fa-spin"></i></span>位小伙伴~
        </span>
    </p>
    
</footer>

</div>
    <ul id="tools">
    <li class="totop-btn fa fa-angle-up"></li>
    <li class="exchange-btn fa fa-exchange"></li>
  
    <li class="toc-btn fa fa-list-ul"></li>
    
    

    
</ul>
<p id="process"></p>
<div id="search-overlay">
    <div class="search-area-wrap">
        <div id="search-area">
            <div class="input-wrap focus">
                <i class="fa fa-search" aria-hidden="true"></i>
                <input id="search-input" autofocus autocomplete="off" type="text"
                       placeholder="search this website..."/>
            </div>
            <ul id="search-result">
                <li class="load-first"><i class="fa fa-spinner fa-pulse"></i></li>
            </ul>
        </div>
    </div>
</div>

    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#ovelayfs简介："><span class="toc-number">1.</span> <span class="toc-text">ovelayfs简介：</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#device-mapper简介："><span class="toc-number">2.</span> <span class="toc-text">device-mapper简介：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#解决方案"><span class="toc-number">2.1.</span> <span class="toc-text">解决方案</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#使用文件"><span class="toc-number">2.1.1.</span> <span class="toc-text">使用文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#使用磁盘"><span class="toc-number">2.1.2.</span> <span class="toc-text">使用磁盘</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#使用逻辑卷"><span class="toc-number">2.1.3.</span> <span class="toc-text">使用逻辑卷</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#dm与overlayfs之间的选择："><span class="toc-number">3.</span> <span class="toc-text">dm与overlayfs之间的选择：</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#启用overlay"><span class="toc-number">4.</span> <span class="toc-text">启用overlay</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#确认overlay启用"><span class="toc-number">5.</span> <span class="toc-text">确认overlay启用</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#配置docker使用overlay"><span class="toc-number">6.</span> <span class="toc-text">配置docker使用overlay</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#启动-amp-amp-查看"><span class="toc-number">7.</span> <span class="toc-text">启动&&查看</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#修改前"><span class="toc-number">7.1.</span> <span class="toc-text">修改前</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#修改后"><span class="toc-number">7.2.</span> <span class="toc-text">修改后</span></a></li></ol></li></ol>


    <script src="/js/highsong.js"></script>



<script src="/js/search.js"></script>
<script type="text/javascript">
    //theme config datas
    var copyrightObj = {};
    copyrightObj.enable = 'true';
    copyrightObj.triggerCopyLength = '200';
    copyrightObj.appendText = '商业转载请联系作者获得授权,非商业转载请注明出处 © gasslinks.com';
    var leancloudObj = {};
    leancloudObj.enable = 'true';
    leancloudObj.className = 'blog';
    leancloudObj.limits = '5';
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?dfebe5842f5d4196471b84802392a4b2";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/javascript">
    var search = {};
    var search_path = "search.xml";
    if (!search_path) {
        search_path = "search.xml";
    }
    search.path = "/" + search_path;
    search.func =  _ajax.init();
</script>
<script src="/js/app.js"></script>


</body>
</html>